package com.linkwedo.saas.directory;

import javax.naming.Context;
import javax.naming.NamingException;

import org.apache.commons.dbcp.BasicDataSource;

public class JNDIService {
	private static Context context;
	public Context getContext() {
		return context;
	}

	public void setContext(Context conte) {
		context = conte;
	}

	public static void bindDataSource(String url, BasicDataSource dynamicDataSource) throws NamingException {
		context.rebind(url, dynamicDataSource);
	}
	
	public static BasicDataSource getDataSource(String url) throws NamingException {
		return (BasicDataSource)context.lookup(url);
	}
	
}
